<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>

    <title></title>

	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
		<link rel="stylesheet" type="text/css" href="../ext/ext-all.css" />
		<script type="text/javascript" src="../ext/ext-base.js"></script>
		<script type="text/javascript" src="../ext/ext-all.js"></script>

	<style type="text/css">
	.ext-ie .x-menu-item-icon {left: -24px; top: 0px;}
	.ext-strict .x-menu-item-icon {left: 3px; top: 3px;}
	.ext-ie6 .x-menu-item-icon {left: -24px; top: 0px;}
	</style>
<script type="text/javascript">
Ext.BLANK_IMAGE_URL = '../images/s.gif';
</script>

	<script type="text/javascript">
	Ext.onReady(function(){

	function loadone()
	{
    var one = new Ext.Panel({
        title:"容器组件",
        width:'30%',
        region:"west",
        height:200,
        layout:"accordion",
        collapsible :true,
        layoutConfig: {animate: true },
        items:[{title:"子元素1",html:"这是子元素1中的内容"},
               {title:"子元素2",html:"这是子元素2中的内容"},
               {title:"子元素3",html:"这是子元素3中的内容"}]
               });

    return  one;
	}

	var AdminRecord = Ext.data.Record.create([
        {name: 'wid', type: 'string'},
        {name: 'wfrom', type: 'string'},
        {name: 'wto', type: 'string'},
        {name: 'wcontent', type: 'string'},
        {name: 'wsendtime', type: 'string'},
        {name: 'waddtime', type: 'string'},
        {name: 'wsendtype', type: 'int'},
        {name: 'wsmsid', type: 'string'},
        {name: 'wsmsflag', type: 'int'},
        {name: 'wchannel', type: 'string'},
        {name: 'wsmsid', type: 'string'},
        {name: 'wactuallysendtime', type: 'int'}

    ]);

    var store = new Ext.data.Store({
        proxy: new Ext.data.HttpProxy({url: '../ajaxjsp/messagelist.jsp'}),
        reader: new Ext.data.JsonReader({
        totalProperty: 'totalCount',
        root: 'result'
        },AdminRecord),
        remoteSort: true
    });


    var columns = new Ext.grid.ColumnModel([
        new Ext.grid.RowNumberer(),
        {header: '发送者', dataIndex: 'wfrom'},
        {header: '接收者', dataIndex: 'wto'},
        {header: '内容', dataIndex: 'wcontent'}
        {header: '添加时间', dataIndex: 'waddtime'},
        {header: '发送类型', dataIndex: 'wsendtype'},
       // {header: '所走通道', dataIndex: 'wchannel'},
        {header: '默认发送时间', dataIndex: 'wsendtime'},
       // {header: '实际发送时间', dataIndex: 'wactuallysendtime'}

    ]);

    columns.defaultSortable = true;

        var grid = new Ext.grid.GridPanel({
        title: '待发消息列表',
        region: 'center',
        loadMask: true,
        store: store,
        cm: columns,
        sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
        viewConfig: {
        columnsText:'显示的列',
        sortAscText:'升序',
        sortDescText:'降序',
        forceFit: true
        }
       //,
       // bbar: new Ext.PagingToolbar({
       //     pageSize: 15,
       //     store: store,
       //     displayInfo: true,
       //     displayMsg: '显示 {0} 条到 {1} 条记录，一共 {2} 条',
       //     emptyMsg:'没有记录'
       // })
    });

    store.load();
    grid.on('rowclick',function (grid,rowIndex,event){
    var record = grid.getStore().getAt(rowIndex);
   	alert('你点击了一行');
    });

	var one1 = loadone();
	var viewport = new Ext.Viewport({
	renderTo:'mt',
	layout:'border',
	items:[
	one1,
	grid
	]
	});


//----定时任务----
		var task = {
			run : function(){
			alert("a");
			},
			interval : 5000
		};

		//var taskRunner = new Ext.util.TaskRunner();
		Ext.TaskMgr.start(task);
	});
	</script>
  </head>

  <body>
   <div id="mt"></div>
   <div id="north"></div>
   <div id="south"></div>
    <div id="wait" align="center"></div>
    <div id="east"></div>
     <div id="west"></div>
  </body>
</html>
